<div class="rc-pannel rc-pagepadding">

    <form class="layui-form" action="">
        <?php
        foreach ($fields as $field) {
        ?>
            <div class="layui-form-item">
                <label class="layui-form-label"><?php echo $field['title'] ?></label>
                <div class="layui-input-block">
                    <?php
                    $element = $field['element'];
                    unset($field['element']);
                    unset($field['id']);
                    $field['value'] = $infomation[$field['name']];
                    echo element($element, ...$field) ?>
                </div>

            </div>
        <?php
        }
        ?>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="submit">确定</button>
                <button type="reset" class="layui-btn ">重置</button>
            </div>

        </div>
    </form>

</div>


<script>
    layui.use(function() {
        var form = layui.form;
        form.on('submit(submit)', function(data) {
            var postdata = data.field;
            $.ajax({
                url: '/uc/Personal/editInfomation?tablename=<?php echo request()->get('tablename') ?>&id=<?php echo request()->get('id') ?>', //请求路径
                type: "POST", //请求方式
                data: postdata, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success("编辑成功", function() {
                            window.parent.location.href = '/uc/Personal/index?tabid=<?php echo request()->get('tabid', 0) ?>';
                        });
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });


    });
</script>